package cn.com.nes.common.generator;

import java.util.concurrent.atomic.AtomicLong;

public final class DefaultSequenceNumberGenerator implements SequenceNumberGenerator {

    private static final SequenceNumberGenerator generator = new DefaultSequenceNumberGenerator();

    private final AtomicLong value = new AtomicLong(0);

    private DefaultSequenceNumberGenerator() {
    }

    @Override
    public Long nextSequenceNumber() {
        return value.incrementAndGet();
    }

    public static SequenceNumberGenerator getInstance() {
        return generator;
    }

}
